#ifndef BASE_CONSOLE_H
#define BASE_CONSOLE_H

#include <vector>
#include <string>
#include <iostream>

#if defined(WIN32)
#include <conio.h>
#else
#include "../common/conio.h"
#endif

using namespace std;

namespace mp_base
{
	typedef vector<string> messages;
	typedef unsigned int uint;

	/*!----------------------------------------------------------------
	*	@class		BaseConsole
	*	@brief		Simple console.
	*
	*	@author		Mitchell Pellno
	*	@date		11/12/2013
	*	@version	1.0
	*
	----------------------------------------------------------------*/
	class BaseConsole
	{
	public:
		BaseConsole(){}

	private:

		/* -- conio.h write methods */

		void Write(string message) { cout << message; }
		void WriteLine(string message){ cout << message << '\n'; }

		/* -- iostream processing methods */

		virtual istream& ProcessIstream(istream& is){
			string input; is >> input; //Get input from stream
			m_messages.push_back(input); //Push input to message array
			Write(input); //Print message to conio.h
			return is; /*Return stream*/
		}

		virtual ostream& ProcessOstream(ostream& os){ return os; }

		/* -- iostream friend operator methods */

		friend ostream& operator<<(ostream& os, BaseConsole& evnt){
			return ProcessOstream(os);
		}

		friend istream& operator>>(istream& is, BaseConsole& evnt){
			return ProcessIstream(is);
		}

		/* ======
		Properties */

		messages	m_messages;
	};
}

#endif